package ObjetData;

import DAO.DaoAnimal;
import java.util.Date;

/**
 *
 * @author Steph
 */
public class Animal extends Article {

    private Integer idAnimal;
    //private String nom;
    private String sexe;
    private int idCouleurPrincipal;
    private Date dateNaissance;
    //private String photo;

    public Animal() {
        //this.nom = "kitty";
    }

    public Animal(Integer idAnimal) {
        this.idAnimal = idAnimal;
        DaoAnimal dao = new DaoAnimal();
        Animal a = dao.find(idAnimal);
        if (a != null) {
            this.dateNaissance = a.getDateNaissance();
            this.idCouleurPrincipal = a.getIdCouleur();
            this.setLabel(a.getLabel());
            this.sexe = a.getSexe();
            this.setIdEspece(a.getIdEspece());
            this.setPhoto(a.getPhoto());
            this.setPrixht(a.getPrixht());
            this.setTva(a.getTva());
        }
    }

    public Animal(int id, String nomValue, String sexeValue) {
        this.setIdAninmal(id);
        this.setLabel(nomValue);
        this.setSexe(sexeValue);
    }

    public Animal(int id, String nomValue, String sexeValue, double prixValue, int qteValue) {
        this.setIdAninmal(id);
        this.setLabel(nomValue);
        this.setSexe(sexeValue);
        this.setPrixht(prixValue);
        this.setTva(19.6);
        this.setQuantite(qteValue);

    }

    public Animal(Animal a) {
        this.dateNaissance = a.getDateNaissance();
        this.idCouleurPrincipal = a.getIdCouleur();
        this.setLabel(a.getLabel());
        this.sexe = a.getSexe();
        this.setIdEspece(a.getIdEspece());
        this.setPhoto(a.getPhoto());
        this.setPrixht(a.getPrixht());
        this.setTva(a.getTva());
    }

    public int getIdAninmal() {
        return idAnimal;
    }

    public void setIdAninmal(int idValue) {
        this.idAnimal = idValue;
    }
    //public String getNom() { return this.nom; }
    //public void setNom(String nom) { this.nom = nom; }

    public int getIdCouleur() {
        return idCouleurPrincipal;
    }

    public void setIdCouleur(int idCouleurPrincipalValue) {
        this.idCouleurPrincipal = idCouleurPrincipalValue;
    }

    public String getSexe() {
        return sexe;
    }

    public void setSexe(String sexeValue) {
        this.sexe = sexeValue;
    }

    public Date getDateNaissance() {
        return dateNaissance;
    }

    public void setDateNaissance(Date dateNaissanceValue) {
        this.dateNaissance = dateNaissanceValue;
    }

    public String toString() {
        return "[ je suis test : " + this.idAnimal + "," + this.getLabel() + "," + this.sexe + "]";
    }

    public void savePersistent() {
        DaoAnimal animalDb = new DaoAnimal();
        animalDb.save(this);
    }
}
